package com.tools.scanner.ui.qrcode.creator.impl

import android.os.Bundle
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.tools.scanner.R
import com.tools.scanner.databinding.FragmentUrlInputBinding
import com.tools.scanner.utils.ToastUtil

class CreateUrlFragment : BaseCreateFragment() {

    private lateinit var mBinding: FragmentUrlInputBinding

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        mBinding = FragmentUrlInputBinding.inflate(inflater, container, false)
        return mBinding.root
    }

    override fun checkParams(): Boolean {
        if (TextUtils.isEmpty(mBinding.editText.text.toString())) {
            ToastUtil.showToast(R.string.input_type_check_text)
            return false
        }
        return true
    }

    override fun createQrCodeContent(): String {
        return mBinding.editText.text.toString()
    }
}